package cn.elves.model.provider;

import cn.elves.model.entity.AuthenticationDTO;
import cn.elves.model.entity.RoleDTO;
import cn.elves.model.entity.dto.response.ResponseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

@FeignClient(value = "auth-service")
public interface AuthProvider {


    @GetMapping("auth/availableMenu")
    ResponseDTO<AuthenticationDTO> getAvailableMenu(@RequestParam("userId") Long userId);

    @GetMapping("auth/isAvailableInterface")
    ResponseDTO<Boolean> decideInterfaceAvailable(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication,
                                                  @RequestParam("userId") String userId,
                                                  @RequestParam("url") String url,
                                                  @RequestParam("method") String method);

    @GetMapping("auth/roles")
    ResponseDTO<Set<RoleDTO>> queryRoleByUserId(@RequestParam("userId") String userId);
}
